<?php

require_once('DBHelperi.class.php');

class DBHelperi_applepie extends DBHelperi
{
    public $env = '';

    public $dbconf = array(
		'DEV' => array(
            'r' => 'mysql://root:123456@192.168.1.110:3306/applepie_dev',
            'w' => 'mysql://root:123456@192.168.1.110:3306/applepie_dev',
        ),
		'PRO' => array(
            'r' => 'mysql://root:123456@192.168.1.110:3306/applepie_dev',
            'w' => 'mysql://root:123456@192.168.1.110:3306/applepie_dev',
        ),
		/*
        'DEV' => array(
            'r' => 'mysql://apdev:apd123xx@172.20.28.151:3306/applepie_dev',
            'w' => 'mysql://apdev:apd123xx@172.20.28.151:3306/applepie_dev',
        ),
		
        'PRO' => array(
            'r' => 'mysql://apxxx:ap123xxx@172.20.28.151:3306/applepie',
            'w' => 'mysql://apxxx:ap123xxx@172.20.28.151:3306/applepie',
        ),*/
    );

    public function __construct($env, $debug=false, $strict=true, $auto_connect=true, $auto_reconnect=true)
    {
        parent::__construct($debug, $strict, $auto_connect, $auto_reconnect);
        $this->env = $env;
    }

    protected function _prepareConnection($type = DBHELPERI_DBALL)
    {
        if ($type & DBHELPERI_DBR) $this->_dbr_url = $this->dbconf[$this->env]['r'];
        if ($type & DBHELPERI_DBW) $this->_dbw_url = $this->dbconf[$this->env]['w'];

        if ($this->_debug)
        {
            if ($type & DBHELPERI_DBR) $this->_debugMessage("DBR URL:".$this->_dbr_url);
            if ($type & DBHELPERI_DBW) $this->_debugMessage("DBW URL:".$this->_dbw_url);
        }

        return true;
    }

}

?>